How to find the index of the closest valid value given two boolean arrays

welcome to shbcf.ru